/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author anhvh_b00319
 */
@Entity
@Table(name = "Branches")
@NamedQueries({
    @NamedQuery(name = "Branches.findAll", query = "SELECT b FROM Branches b"),
    @NamedQuery(name = "Branches.findByBraID", query = "SELECT b FROM Branches b WHERE b.braID = :braID"),
    @NamedQuery(name = "Branches.findByBraName", query = "SELECT b FROM Branches b WHERE b.braName = :braName"),
    @NamedQuery(name = "Branches.findByBraAddress", query = "SELECT b FROM Branches b WHERE b.braAddress = :braAddress"),
    @NamedQuery(name = "Branches.findByBraPhone", query = "SELECT b FROM Branches b WHERE b.braPhone = :braPhone")})
public class Branches implements Serializable {

    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Bra_ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer braID;
    @Basic(optional = false)
    @Column(name = "Bra_Name")
    private String braName;
    @Basic(optional = false)
    @Column(name = "Bra_Address")
    private String braAddress;
    @Basic(optional = false)
    @Column(name = "Bra_Phone")
    private String braPhone;

    public Branches() {
    }

    public Branches(Integer braID) {
        this.braID = braID;
    }

    public Branches(Integer braID, String braName, String braAddress, String braPhone) {
        this.braID = braID;
        this.braName = braName;
        this.braAddress = braAddress;
        this.braPhone = braPhone;
    }

    public Integer getBraID() {
        return braID;
    }

    public void setBraID(Integer braID) {
        Integer oldBraID = this.braID;
        this.braID = braID;
        changeSupport.firePropertyChange("braID", oldBraID, braID);
    }

    public String getBraName() {
        return braName;
    }

    public void setBraName(String braName) {
        String oldBraName = this.braName;
        this.braName = braName;
        changeSupport.firePropertyChange("braName", oldBraName, braName);
    }

    public String getBraAddress() {
        return braAddress;
    }

    public void setBraAddress(String braAddress) {
        String oldBraAddress = this.braAddress;
        this.braAddress = braAddress;
        changeSupport.firePropertyChange("braAddress", oldBraAddress, braAddress);
    }

    public String getBraPhone() {
        return braPhone;
    }

    public void setBraPhone(String braPhone) {
        String oldBraPhone = this.braPhone;
        this.braPhone = braPhone;
        changeSupport.firePropertyChange("braPhone", oldBraPhone, braPhone);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (braID != null ? braID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Branches)) {
            return false;
        }
        Branches other = (Branches) object;
        if ((this.braID == null && other.braID != null) || (this.braID != null && !this.braID.equals(other.braID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Branches[braID=" + braID + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
}
